-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(plugin config): add dependency for delete plugin config #6092
feat(plugin config): add dependency for delete plugin config #6092
Conversation
t/admin/delete-plugin-configs.t
Outdated
@@ -0,0 +1,174 @@ | |||
# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add it to t/admin/plugin-configs.t
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.
t/admin/delete-plugin-configs.t
Outdated
} | ||
} | ||
}]], | ||
[[{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to check the response in every test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.
apisix/admin/plugin_config.lua
Outdated
end | ||
|
||
local routes, routes_ver = get_routes() | ||
core.log.info("routes: ", core.json.delay_encode(routes, true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary to dump all the routes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it with reference to the processing of upstream. At the same time, I also considered whether to logging all route information. If it is not log here, does it also need to be modified in upstream?
apisix/apisix/admin/upstreams.lua
Line 130 in c38e94f
core.log.info("routes: ", core.json.delay_encode(routes, true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the size of Nginx log is limited, we can't log all the routes. Let's remove it.
apisix/admin/plugin_config.lua
Outdated
end | ||
|
||
local routes, routes_ver = get_routes() | ||
core.log.info("routes: ", core.json.delay_encode(routes, true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the size of Nginx log is limited, we can't log all the routes. Let's remove it.
t/admin/plugin-configs.t
Outdated
ngx.say(body) | ||
} | ||
} | ||
--- request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove the duplicate sections which are set in the beginning.
t/admin/plugin-configs.t
Outdated
GET /t | ||
--- response_body | ||
passed | ||
--- no_error_log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm%nits
--- config | ||
location /t { | ||
content_by_lua_block { | ||
ngx.sleep(0.3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, is there any reason for which we need to add this 0.3-sec sleep?
Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current step depends on the previous steps, so set a short time for etcd to sync data.
--- config | ||
location /t { | ||
content_by_lua_block { | ||
ngx.sleep(0.3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
--- config | ||
location /t { | ||
content_by_lua_block { | ||
ngx.sleep(0.3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
I found the CI is broken with msg:
https://github.com/apache/apisix/runs/4836910403?check_suite_focus=true |
Thanks for your careful, but I don't know how to slove this problem. Any one can help me to do this ? |
Usually, it is because of a malformed config section. Could you check the |
Got it, and CI passed now. |
What this PR does / why we need it:
fix #5917
When a plugin config is referencing by any route, it should not be deleted.
example:
create plugin config:
bounding route to plugin config:
Then, delete plugin config, apisix will return 400 error.
Pre-submission checklist: